package design.donkey.auto.ddl.dialect.mysql.handler;

import design.donkey.auto.ddl.model.ColumnMetaModel;
import design.donkey.framework.common.util.CommonUtils;

/**
 * 备注处理
 *
 * @since 0.0.1
 * @author zhangjiakung
 */
public class ColumnHandlerForComment implements ColumnHandler {
    @Override
    public String handle(ColumnMetaModel columnMetaModel) {
        String comment = columnMetaModel.getComment();
        if (CommonUtils.isEmpty(comment)) {
            return null;
        }
        return String.format("COMMENT '%s'", comment.replace("'", "\\'"));
    }
}
